home *** CD-ROM | disk | FTP | other *** search
- GUI Interface Programmers Library v. 1.40
- for QuickBasic 4.5
- Copyright (c) 1996 - 1997 by Tika Carr
- Rev. 10/12/1996, 12/12/1996, 06/28/1997
- ---------------------------------------------------------------------
-
- **** To make the GUI Library ****
-
- 1. Start QuickBasic 4.5 with the following parameters:
-
- QB /AH /L QB.QLB
-
- 2. From the Run menu, select Make Library.
- 3. In the "Quick Library File Name" box, type in: GUI
- Do NOT give an extension!
- 4. Click on "Make Library and Exit".
-
- The following files will be found: GUI.LIB, GUI.QLB, GUI140.OBJ. You can
- delete the GUI140.OBJ if you want, as its not needed.
- ---------------------------------------------------------------------
-
- **** To Use the GUI Library ****
-
- 1. Make sure you placed the GUI.LIB and GUI.QLB in a directory where
- QuickBasic can find it. Usually its where you'll find QB.QLB.
-
- 2. You must start QuickBasic with this command line:
-
- QB /ah /l gui.qlb
-
- You can also add in other command line options too, but at least
- these MUST be present. A QBGUI.BAT file is included as well. Just
- type QBGUI [other options] to start QB with the GUI library. This
- assumes that QB.EXE is in your PATH or same directory as the batch
- file.
-
- 3. One of the very first things (besides DECLARE and REMark statements)
- that you MUST put in your program is: '$INCLUDE: 'GUI.BI'
- This sets up all the variables, and the screen mode, etc. for the
- GUI library to work. From there, just start programming!
-
- There is a demo, GUIDEMO.BAS that you may look at to see how to
- program using this library.
- ---------------------------------------------------------------------
-
- **** OVERVIEW ****
-
- The GUI Library is designed to help programmers create GUI programs with
- pop up windows, 3-D buttons and bars, check boxes, radio buttons and
- more. This library also has mouse support and works only in the 640 x
- 480 16-color screen 12 mode.
- ---------------------------------------------------------------------
-
- **** PALETTE, COLORS & SCREEN MODE ****
-
- In Screen 12, you can use up to 16 colors at a time, but you can change
- any of these to any of 262,144 different colors. The white% and black%
- are variables used to declare color 0 for black and color 15 for white.
- Changing the palette of color 0 and/or 15 will cause things like the
- buttons (drwbtn) to be off color and some things may not have the 3-D
- look as expected. You do NOT have to have SCREEN 12 in your program, as
- that is already defined for you in the GUI.BI file.
- ---------------------------------------------------------------------
-
- **** REFERENCE GUIDE ****
-
- Clearing the Screen:
- --------------------
-
- CALL clrscrn (color)
- clrscrn color
-
- This lets you clear the screen in any color 0 - 15.
- ---------------------------------------------------------------------
- Mouse Function:
- ---------------
-
- CALL Mouse("mode")
- Mouse "mode"
-
- Version 1.40 now lets you use words to set the mouse mode, instead of
- hard to remember numbers.
-
- Modes are:
-
- "init" initialize mouse
- "show" show mouse pointer on screen
- "hide" hide mouse pointer (useful when drawing stuff)
- "get" get mouse x, y and button information
-
- Example Code:
-
- Mouse 0 'Initialize Mouse (REQUIRED to be called once at start of
- 'program)
- Mouse 1 'Show Mouse pointer
- WHILE mb% = 0
- Mouse 3
- 'Check to see if mouse is in certain boundaries when button is
- pressed.
- IF mx% > x1 AND mx% < x2 AND my% > y1 AND my% < y2 AND mb% = 1 THEN
- 'Do what you want here when the mouse is "clicked" in certain
- 'boundaries
- END IF
- WEND
- Mouse 2 'Hide the mouse (don't show mouse pointer)
-
- Note that mx%, my% and mb% are global variables declared in GUI.BI.
- ---------------------------------------------------------------------
- Transparent Text Printing:
- --------------------------
-
- CALL gprint ("Text", x, y, color)
- gprint "Text", x, y, color
-
- This routine lets you print text on screen according to pixel location.
- Put the Text in quotes. X and Y are Pixel locations, not LOCATE
- locations, so you can go x up to 640 and Y up to 480. Do keep in mind
- that each character of text is 8 pixels by 8 pixels. color is from 0 to
- 15.
- ---------------------------------------------------------------------
- Buttons, Pop Up Menus, Frames, Check Boxes, Radio Buttons:
- ----------------------------------------------------------
-
- CALL drwbtn (style, color, frame offset, frame color, x1, y1, x2, y2)
- drwbtn style, color, frame offset, frame color, x1, y1, x2, y2
- | | | | | |
- -------- --------------- -------------
- Inside Outside Coordinates
- of button/frame of frame
-
- x1, y1 is upper left; x2, y2 is lower right
-
- 3-D Push Buttons:
- -----------------
- Styles 1 & 2 are for making those push buttons like "OK" or "Cancel",
- etc.
-
- Style 1 - pushed in button
- Style 2 - is a normal button
-
- drwbtn 1, 3, 0, 0, 3, 3, 55, 18 'Button is pushed (selected).
- drwbtn 2, 3, 0, 0, 75, 3, 121, 18 'Button is not pushed.
-
- Note that the frame offset and color values are not used for push
- buttons.
-
- Framed Pop-Ups:
- ---------------
- There are four styles of framed popup type windows that give a 3-D look:
-
- drwbtn 3, 6, 10, 5, 3, 25, 103, 125 'Frame Style 3
- drwbtn 4, 3, 10, 2, 110, 25, 210, 125 'Frame Style 4
- drwbtn 5, 8, 10, 7, 220, 25, 320, 125 'Frame Style 5
- drwbtn 6, 11, 10, 10, 340, 25, 440, 125 'Frame Style 6
-
- Style 3: Inlaid frame with embossed interior.
- Style 4: Embossed frame with inlaid interior.
- Style 5: Inlaid frame and interior.
- Style 6: Embossed frame and interior.
-
- Note that we used an offset of 10 in the above 4 examples. This gives
- us a nice frame boarder. You can set this at any size in pixels that
- you wish.
-
- Check Boxes:
- ------------
- Styles 7 and 8 create check boxes:
-
- drwbtn 7, 4, 0, 0, 3, 135, 18, 150 'Plain Check Box
- drwbtn 8, 4, 0, 0, 23, 135, 38, 150 'Plain Check Box Checked
-
- Note again that the frame values are not used.
-
- Radio Buttons:
- --------------
- Radio buttons use the values a bit differently from the others. They
- are:
-
- drwbtn style, color, radius, center mark color, x, y, nul, nul
-
- Styles 9 and 10 provide you with the standard circular radio buttons:
-
- CALL drwbtn(9, 9, 8, 0, 50, 143, 0, 0) 'Radio Button
- CALL drwbtn(10, 9, 8, 15, 70, 143, 0, 0) 'Radio Button On
-
- The center mark color is the color of the dot that goes in the center
- of a selected radio button. Only the x and y coordinates are needed,
- and the other x and y parameters are 0 (not used).
- ---------------------------------------------------------------------
- Popup Input Box:
- ----------------
-
- This lets you create a box that the user can input text in. See the
- GUIDEMO.BAS program for example usage.
-
- CALL PopInp$ (Prompt$, Length%, x%, y%, bc%, tc%, fc%, ft%, cc%)
- PopInp$ Prompt$, Length%, x%, y%, bc%, tc%, fc%, ft%, cc%
-
- Prompt$ what you'd like to ask the user
- Length the maximum amount of characters you will allow in the input
- field
- x1, y1 upper left corner coordinates
- bc color of background of the popup box
- tc text color
- fc input field color
- ft input field text color
- cc cursor color
- ---------------------------------------------------------------------
- Pop Up Boxes:
- -------------
-
- CALL PopUpBox (x%, y%, clrbox%, clrbdr%, clrtext%, TextArray$())
- PopUpBox x%, y%, clrbox%, clrbdr%, clrtext%, TextArray$()
-
- This is a handy routine for a quick pop up box with an OK button in it.
- Here is an example of its use:
-
- A$(1) = "This is a Test."
- A$(2) = "Of the PopUpBox Sub."
- PopUpBox 140, 100, 7, 8, 1, A$()
-
- x, y Upper left corner of the box. The other dimensions are
- calculated automatically, based on the text you are going to put
- into it.
- clrbox color of the inside of the box (where the text is printed).
- clrbdr color of the boarder around the box (uses drwbtn for 3D look).
- clrtext color of the text you put in the box.
- TextArray$() is where you pass the array that you have the text stored
- in. This MUST be an array! If its only 1 line, then just do:
- A$(1)="Your Line Here" and pass it to PopUpBox as A$(). ALWAYS pass your
- arrays with just parenthesis (). Do NOT put in any subscripts! For
- example:
-
- PopUpBox 140, 100, 7, 8, 1, A$(2) WRONG!
- PopUpBox 140, 100, 7, 8, 1, A$(MaxVal) WRONG!
- PopUpBox 140, 100, 7, 8, 1, A$ WRONG!
- PopUpBox 140, 100, 7, 8, 1, A$() Right!
- ---------------------------------------------------------------------
- Creating and Maintaining Buttons:
- ---------------------------------
-
- CALL button$ (x%, y%, t$, bc%, tc%, hl%, cp%, flag%)
- button$ (x%, y%, t$, bc%, tc%, hl%, cp%, flag%)
-
- x, y Upper left of button (the rest is automatically calculated)
- t$ The text to place in the button
- bc color of the button
- tc text color
- hl color of the letter that will be highlighted (if none, use the
- same color as tc).
- cp position of the letter in the text that is to be highlighted (if
- none, then just pass a 1 anyway).
- flag This is 1 if it is NOT pushed and 0 if its pushed.
-
- See in the GUIDEMO.BAS code where the following line is:
- '** Define a couple of buttons
-
- This will show you how buttons are defined and used. There is a sort of
- handle system involved so that you can tell if a button is pushed or
- not. button$ is a function that returns the button location so that you
- can test if the mouse clicks on it. The pushbtn function will check to
- see if that button is pushed, and returns a value of 1 if is was pushed
- or a value of 0 if not. The GUIDEMO.BAS code shows how this works.
- ---------------------------------------------------------------------
- Title Bar:
- ----------
-
- CALL TitleBar (t$, bc%, tc%)
- TitleBar t$, bc%, tc%
-
- t$ The text you want to place in the title bar
- bc The color of the bar
- tc The color of the text
-
- This function places a 3-D Title Bar at the top of the screen and
- automatically centers your text inside it.
- ---------------------------------------------------------------------
-
- **** IN CLOSING ****
-
- I know last revision (1.23, I believe) I said I would stop developing
- this library, but I came up with a couple more things, so here it all
- is, sources and all. Have fun. :) However, due to lack of time, etc. I
- can't promise any further development. I'm not able to provide technical
- support for this library. In other words, if you like it, use it and
- enjoy. If you find bugs, try to work around them the best you can, or
- work on the source code. I have done a lot of work on this library and
- its getting a bit too complicated to continue with. However, if you do
- improve the source code, please let me know so I too can update the
- library for myself. Cut and paste, or use as you like. Just adhere to
- the "LEGAL STUFF" below. Thanks. :)
-
- Tika Carr
- t.carr@pobox.com
- http://www.pobox.com/~t.carr
- ---------------------------------------------------------------------
-
- **** LEGAL STUFF ****
-
- THIS PROGRAM IS RELEASED AS FREEWARE. I RESERVE THE COPYRIGHT TO THE
- PACKAGE AND ALL OF THE ROUTINES I HAVE WRITTEN. OTHER CONTRIBUTORS HOLD
- CLAIM TO THEIR OWN ROUTINES, AND HAVE AGREED TO ALLOW ME TO INCLUDE THEM
- IN THIS PACKAGE. IF YOU USE ANY OF THESE ROUTINES IN YOUR OWN CODE,
- PLEASE CREDIT THE AUTHOR IN AN ABOUT BOX OR OTHER WAY SO THAT USERS OF
- YOUR PROGRAM SEE WHO ALSO WROTE SOME OF THE CODE.
-
- THIS LIBRARY AND SOURCE CODE IS DISTRIBUTED ON AN "AS IS" BASIS. THE
- AUTHOR(S) DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT
- NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR ANY
- PURPOSE. THE AUTHOR(S) ASSUME NO LIABILITY FOR DAMAGES, DIRECT OR
- CONSEQUENTIAL, WHICH MAY RESULT FROM USE OF THIS LIBRARY. YOUR RIGHTS
- MAY VARY DEPENDING ON YOUR STATE OR LOCATION SO THE ABOVE WARRANTIES MAY
- OR MAY NOT APPLY TO YOU. IN ANY EVENT, YOU AGREE NOT TO SEEK LITIGATION
- AGAINST THE AUTHOR(S) FOR ANY REASON. IF THIS LIBRARY WILL NOT SUIT YOUR
- NEEDS OR YOU FIND IT DISRUPTIVE, THEN SIMPLY DON'T USE IT. NO
- COMPENSATION WILL BE GIVEN BY THE AUTHOR(S).
- ---------------------------------------------------------------------
-
- **** LICENSE OF USE ****
-
- This code is usable by anyone who wishes, as long as they give credit to
- the proper people in their program code (see credits list) and in the on-
- screen of the finished product (ie. in an "About" menu). The code in
- this library is only for Freeware, Shareware, personal or hobby use, and
- NOT for commercial use. Commercial developers, including CD-ROM
- shareware/collection houses, etc. must contact me to make arrangements
- for use of any of these routines.
- ---------------------------------------------------------------------
-
- **** CREDITS ****
-
- GUI Library concept, include file, documentation, etc. were all written
- by Tika Carr. All functions written by Tika Carr except the gprint
- routine, which was written by Douglas Lusher. This routine has been
- placed in the public domain and is free for anyone's use (so I used it
- in my library :)
-
- Microsoft QuickBasic is a trademark of Microsoft Corp.
-
-
-
-
-